<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>试卷列表</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<div class="container mt-5">
    <h1>我的试卷</h1>

    <!-- 导航菜单 -->
    <div class="mt-4 mb-4">
        <ul class="nav nav-pills">
            <li class="nav-item">
                <a class="nav-link" href="${pageContext.request.contextPath}/student/home">首页</a>
            </li>
            <li class="nav-item">
                <a class="nav-link active" href="#">查看试卷</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="viewExamRecords" href="${pageContext.request.contextPath}/student/viewExamRecords">查看考试记录</a>
            </li>
        </ul>
    </div>

    <!-- 试卷列表 -->
    <!-- 可参加试卷列表 -->
    <div class="card mt-4">
        <div class="card-header">
            <h4>可参加试卷</h4>
        </div>
        <div class="card-body">
            <table class="table table-striped">
                <thead>
                <tr>
                    <th>试卷标题</th>
                    <th>出卷人</th>
                    <th>试卷总分</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody id="examTableBody">
                <!-- 动态填充 -->
                </tbody>
            </table>
        </div>
    </div>

    <!-- 试卷详情模态框 -->
    <div class="modal fade" id="examModal" tabindex="-1" aria-labelledby="examModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="examModalLabel">试卷详情</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <!-- 试卷信息展示 -->
                    <div class="mb-4">
                        <h3 id="examTitleDetail" class="text-center"></h3>
                        <p class="text-center" id="examCreator"></p>
                        <p class="text-center" id="examTotalScore"></p>
                        <p class="text-center" id="examScorePerQuestion"></p>
                    </div>

                    <hr>

                    <!-- 题目列表 -->
                    <div id="examQuestionsList"></div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="submitExamBtn">提交试卷</button>
                </div>
            </div>
        </div>
    </div>

</div>
<script src="${pageContext.request.contextPath}/static/js/student/examList.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
